package com.hang.gymmanager.controller;

import com.hang.gymmanager.common.Response;
import com.hang.gymmanager.entity.AlipayOrderEntity;
import com.hang.gymmanager.req.AddOrderReq;
import com.hang.gymmanager.service.AlipayOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 支付宝支付订单表 前端控制器
 *
 */
@RestController
@RequestMapping("/alipayOrder")
@RequiredArgsConstructor
@CrossOrigin
public class AlipayOrderController {

    private final AlipayOrderService alipayOrderService;

    /**
     * 创建订单
     * @return
     */
    @PostMapping("/createOrder")
    public Response<?> createOrder(@RequestBody AddOrderReq req) {
        AlipayOrderEntity order = alipayOrderService.createOrder(req);
        return Response.success(order);
    }

//    /**
//     * 获取订单信息
//     * @param orderId
//     * @return
//     */
//    @GetMapping("/getOrderInfo")
//    public Response<?> getOrderInfo(String orderId) {
//        AlipayOrderEntity orderInfo = alipayOrderService.getOrderInfo(orderId);
//        return Response.success(orderInfo);
//    }
}
